package main

import (
	"errors"
	"fmt"
)

func div(a int, b int) (int, error) {
	if b == 0 {
		err := errors.New("0不能作为除数")
		return 0, err
	} else {
		value := a / b
		return value, nil
	}
}

func main() {
	res, err := div(20, 0)
	if (err != nil) {
		fmt.Println(err)
	} else {
		fmt.Println(res)
	}

}
